package team.pwyseckill.mapper;


import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import team.pwyseckill.pojo.entity.Seckill;

import java.util.List;

@Repository
public interface SeckillMapper {

    @Select("select * from pwy.pwy_seckill where id = #{value}")
    Seckill findBySeckillId(Integer seckillId);

    @Update("update pwy.pwy_seckill set number = number - 1 where id = #{value}")
    Integer updateNumber(Integer seckillId);

    @Update("update pwy.pwy_seckill set status = 1 where id = #{value}")
    void updateActiveStatusById(Integer seckillId);

    //活动结束,状态 1 - 2
    @Update("update pwy.pwy_seckill set status = 2 where id = #{value}")
    int updateEndStatus(Integer seckillId);
}
